Fakultas Ilmu Komputer UI

Commit 3b4ee3bf authored by KIANUTAMA RADIANUR HUDHA's avatar KIANUTAMA RADIANUR HUDHA
Browse files

Merge branch '1606887516-105' into 'master'

Add default value for edit company profile input

See merge request !121
parents 3d3a14e5 04e29d71
Pipeline #24523 passed with stages
in 26 minutes and 9 seconds
......@@ -49,7 +49,7 @@ export default class CompanyProfile extends React.Component {
getProfile() {
return Server.get(`/companies/${this.state.id}/`).then((result) => {
this.setState({name:result.name, address:result.address, category:result.category, id:result.id,
description:result.description, refresh: this.state.refresh + 1, website:result.website
description:result.description, refresh: this.state.refresh + 1, website:result.website
});
if(result.logo != '') {
this.setState({logo: result.logo});
......@@ -142,16 +142,19 @@ export default class CompanyProfile extends React.Component {
<Form size="small" ref={(input) => { this.form = input; }} key={this.state.refresh} onSubmit={this.handleSubmit}>
<Form.Field>
<label htmlFor="name">Nama Perusahaan</label>
<input placeholder="Nama Perusahaan" name="name" onChange={this.handleChange}/>
<input placeholder="Nama Perusahaan" name="name" onChange={this.handleChange}
defaultValue={this.state.name === null ? null : this.state.name}/>
</Form.Field>
<Form.Field>
<label htmlFor="address">Alamat Perusahaan</label>
<input placeholder="Alamat Perusahaan" name="address" onChange={this.handleChange}/>
<input placeholder="Alamat Perusahaan" name="address" onChange={this.handleChange}
defaultValue={this.state.address === null ? null : this.state.address}/>
</Form.Field>
<Form.Field>
<label htmlFor="description">Deskripsi</label>
<TextArea placeholder='Try adding multiple lines' name="description" onChange={this.handleChange}
autoHeight />
autoHeight
defaultValue={this.state.description === null ? null : this.state.description}/>
</Form.Field>
<Button type="submit" size="small" loading={this.state.loading} primary floated="right">Submit</Button>
</Form>
......
......@@ -78,7 +78,7 @@ class StudentViewSet(viewsets.ModelViewSet):
return Response({}, status=status.HTTP_200_OK)
else:
return Response({}, status=status.HTTP_415_UNSUPPORTED_MEDIA_TYPE)
serializer = self.serializer_class(user, data=request.data, partial=True)
if serializer.is_valid():
serializer.save()
......@@ -235,7 +235,7 @@ class CompanyRegisterViewSet(viewsets.GenericViewSet):
---
parameters:
- name: username
description: username of the new account
description: username of the new account
required: true
type: string
- name: password
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment